import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path";
// import {
//   AntDesignVueResolver,
//   ElementPlusResolver,
// } from "unplugin-vue-components/resolvers";//自动引入组件
import AutoImport from "unplugin-auto-import/vite";//自动引入组件
import Components from "unplugin-vue-components/vite";//自动引入组件
import cesium from 'vite-plugin-cesium';

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(), cesium(),
  Components(
    {//自动引入组件
      resolvers: [
        // AntDesignVueResolver({ importStyle: "less" }),
        // ElementPlusResolver({ importStyle: "sass" }),
      ],
      dts: "src/typings/components.d.ts", //自定义生成 components.d.ts 路径
    }),
  AutoImport({
    imports: [
      "vue",
      "vue-router",
      // "pinia",
      // "vue-i18n",
      "@vueuse/core",
      //一些全局注册的hook等，无需局部引入
      {
        // "@/hooks/useMessage": ["useMessage"],
      },
    ],
    // resolvers: [AntDesignVueResolver(), ElementPlusResolver()], //ElementPlusResolver()
    dts: "src/typings/auto-imports.d.ts", //自定义生成 auto-imports.d.ts 路径
  }),
  ],
  resolve: {
    // alias: {
    //   '@': fileURLToPath(new URL('./src', import.meta.url))//路径别名
    // },
    alias: {
      "@": resolve(__dirname, "src"),
    },
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],//导入文件时省略的扩展名列表
  },
  server: {
    host: '0.0.0.0',
    port: 8818
  }
})
